Upgrade to hypersync-client-rust v1.0.1 with new fields and fixes#50
Upgrade to hypersync-client-rust v1.0.1 with new fields and fixes#50
Conversation
Major upgrade of the underlying Rust client from v0.17 to v1.0.1. Key changes: - DNS failover fix: HTTP client now refreshes connections every 60s to ensure DNS lookups catch server IP changes during failovers - Migrated Arrow FFI from polars-arrow (v0.42) to arrow-rs (v57) - Updated alloy crates from 0.8 to 1.1 - Renamed bearer_token to api_token (backward compat preserved) - Added new Transaction fields: blob_gas_price, blob_gas_used, deposit_nonce, deposit_receipt_version, l1_base_fee_scalar, l1_blob_base_fee, l1_blob_base_fee_scalar, l1_block_number, mint, sighash, source_hash - Added new Trace fields: sighash, action_address, balance, refund_address - Added DataType.DECIMAL256 and DataType.DECIMAL128 - Added StreamConfig.reverse for reverse-order streaming - Fixed Block.send_count, send_root, mix_hash mappings (were incorrectly mapped to transactions_root) - EventResponse data flattened from Vec<Vec<Event>> to Vec<Event> See CHANGELOG.md and MIGRATION_GUIDE.md for full details. https://claude.ai/code/session_01KKQaiY8uNKsLqKz5eAu1fe
📝 WalkthroughWalkthroughRelease v0.10.0 upgrades hypersync-client-rust with dependency updates (alloy 1.1, arrow FFI migration from polars-arrow), adds transaction/trace fields for EIP-4844 blobs and L2 chains, renames ClientConfig.bearer_token to api_token with backward compatibility, and fixes block field mappings. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Cargo.toml`:
- Line 23: The Cargo.toml currently uses a sibling path dependency for
hypersync-client which breaks clean checkouts; replace the path dependency entry
for hypersync-client with a published crate version (remove the path =
"../hypersync-client-rust/hypersync-client" and add a version = "..." specifier
for the hypersync-client dependency) so builds resolve from crates.io (pick the
appropriate released version for hypersync-client and update any feature flags
if needed).
In `@hypersync/__init__.py`:
- Around line 723-726: The dataclass field order was changed causing
positional-arg breakage: move the api_token field declaration to appear after
bearer_token in the dataclass in hypersync/__init__.py so that the generated
__init__ preserves the original parameter order (keep both fields and their
comments, updating only their order) to maintain backward-compatible positional
argument behavior for ClientConfig (and any other affected dataclass).
In `@src/config.rs`:
- Around line 83-88: The serialized config still contains the deprecated
bearer_token when both tokens exist; update the code that prepares serialization
(the config clone block around api_token and bearer_token) to explicitly
remove/drop the old field before serializing: after you set config.api_token =
config.bearer_token.take() (or if config.api_token.is_some()), ensure
config.bearer_token = None so serde_json::to_vec(&config) will not emit
bearer_token; reference the local variable config and the fields api_token and
bearer_token in your change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8ca00a4a-1a7b-4924-b2ec-bfb6ef11c469
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (8)
CHANGELOG.mdCargo.tomlMIGRATION_GUIDE.mdhypersync/__init__.pysrc/arrow_ffi.rssrc/config.rssrc/response.rssrc/types.rs
| alloy-json-abi = "1.1" | ||
| alloy-dyn-abi = "1.1" | ||
| alloy-primitives = "1.1" | ||
| hypersync-client = { path = "../hypersync-client-rust/hypersync-client" } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n '^\s*hypersync-client\s*=' Cargo.toml
python - <<'PY'
from pathlib import Path
root = Path('.').resolve()
dep = (root / '../hypersync-client-rust/hypersync-client').resolve()
inside_repo = dep == root or root in dep.parents
print(f"repo_root={root}")
print(f"resolved_dependency_path={dep}")
print(f"exists={dep.exists()}")
print(f"inside_repo={inside_repo}")
PYRepository: enviodev/hypersync-client-python
Length of output: 291
Don't ship a sibling path dependency in the release manifest.
This dependency only resolves when ../hypersync-client-rust/hypersync-client exists as a sibling directory outside the repository. Clean checkouts lack this directory, breaking source installs, sdists, and wheel builds. Use a published version instead:
-hypersync-client = { path = "../hypersync-client-rust/hypersync-client" }
+hypersync-client = "1.0.1"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| hypersync-client = { path = "../hypersync-client-rust/hypersync-client" } | |
| hypersync-client = "1.0.1" |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@Cargo.toml` at line 23, The Cargo.toml currently uses a sibling path
dependency for hypersync-client which breaks clean checkouts; replace the path
dependency entry for hypersync-client with a published crate version (remove the
path = "../hypersync-client-rust/hypersync-client" and add a version = "..."
specifier for the hypersync-client dependency) so builds resolve from crates.io
(pick the appropriate released version for hypersync-client and update any
feature flags if needed).
| # HyperSync server API token. | ||
| api_token: Optional[str] = None | ||
| # Deprecated: use api_token instead. Kept for backward compatibility. | ||
| bearer_token: Optional[str] = None |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python - <<'PY'
from dataclasses import dataclass
from typing import Optional
import inspect
`@dataclass`
class OldClientConfig:
url: Optional[str] = None
bearer_token: Optional[str] = None
http_req_timeout_millis: Optional[int] = None
`@dataclass`
class NewClientConfig:
url: Optional[str] = None
api_token: Optional[str] = None
bearer_token: Optional[str] = None
http_req_timeout_millis: Optional[int] = None
print("old_signature:", inspect.signature(OldClientConfig))
print("new_signature:", inspect.signature(NewClientConfig))
print("binding_example:", NewClientConfig("u", None, 1000))
PYRepository: enviodev/hypersync-client-python
Length of output: 483
🏁 Script executed:
cd /tmp && git ls-files | grep -E 'hypersync.*__init__' | head -5Repository: enviodev/hypersync-client-python
Length of output: 144
🏁 Script executed:
# Find and examine the ClientConfig class definition
rg -A 20 'class ClientConfig' --no-headingRepository: enviodev/hypersync-client-python
Length of output: 1342
🏁 Script executed:
# Search for ClientConfig(...) positional calls
rg 'ClientConfig\s*\(' -B 2 -A 2Repository: enviodev/hypersync-client-python
Length of output: 10975
🏁 Script executed:
rg -B 5 'class ClientConfig' hypersync/__init__.pyRepository: enviodev/hypersync-client-python
Length of output: 179
🏁 Script executed:
# Check if there are any positional-style calls (without keywords)
rg 'ClientConfig\s*\(\s*["\']'Repository: enviodev/hypersync-client-python
Length of output: 144
🏁 Script executed:
# More thorough check for any positional calls - look for patterns like ClientConfig(something, something_else)
rg 'ClientConfig\([^)]*,' --no-headingRepository: enviodev/hypersync-client-python
Length of output: 58
Add api_token after bearer_token to preserve positional argument compatibility.
@dataclass generates __init__ parameters in field declaration order. Inserting api_token before bearer_token shifts every later positional argument—code like ClientConfig(url, bearer_token_val, http_req_timeout_millis=5000) would misalign. Though the codebase uses only keyword arguments, external users may rely on positional calls.
Backwards-compatible field order
class ClientConfig:
"""Configuration for the hypersync client."""
# HyperSync server URL.
url: Optional[str] = None
# Deprecated: use api_token instead. Kept for backward compatibility.
bearer_token: Optional[str] = None
+ # HyperSync server API token.
+ api_token: Optional[str] = None🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@hypersync/__init__.py` around lines 723 - 726, The dataclass field order was
changed causing positional-arg breakage: move the api_token field declaration to
appear after bearer_token in the dataclass in hypersync/__init__.py so that the
generated __init__ preserves the original parameter order (keep both fields and
their comments, updating only their order) to maintain backward-compatible
positional argument behavior for ClientConfig (and any other affected
dataclass).
| // Handle bearer_token → api_token backward compatibility | ||
| let mut config = self.clone(); | ||
| if config.api_token.is_none() && config.bearer_token.is_some() { | ||
| config.api_token = config.bearer_token.take(); | ||
| } | ||
| let json = serde_json::to_vec(&config).context("serialize to json")?; |
There was a problem hiding this comment.
Drop bearer_token before serializing the config.
When both token fields are set, this still emits the deprecated bearer_token downstream. That means this code never actually enforces the documented "api_token takes precedence" rule; it only works if the receiver happens to ignore the old field.
Minimal fix
// Handle bearer_token → api_token backward compatibility
let mut config = self.clone();
- if config.api_token.is_none() && config.bearer_token.is_some() {
- config.api_token = config.bearer_token.take();
- }
+ if config.api_token.is_none() {
+ config.api_token = config.bearer_token.take();
+ }
+ config.bearer_token = None;
let json = serde_json::to_vec(&config).context("serialize to json")?;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // Handle bearer_token → api_token backward compatibility | |
| let mut config = self.clone(); | |
| if config.api_token.is_none() && config.bearer_token.is_some() { | |
| config.api_token = config.bearer_token.take(); | |
| } | |
| let json = serde_json::to_vec(&config).context("serialize to json")?; | |
| // Handle bearer_token → api_token backward compatibility | |
| let mut config = self.clone(); | |
| if config.api_token.is_none() { | |
| config.api_token = config.bearer_token.take(); | |
| } | |
| config.bearer_token = None; | |
| let json = serde_json::to_vec(&config).context("serialize to json")?; |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/config.rs` around lines 83 - 88, The serialized config still contains the
deprecated bearer_token when both tokens exist; update the code that prepares
serialization (the config clone block around api_token and bearer_token) to
explicitly remove/drop the old field before serializing: after you set
config.api_token = config.bearer_token.take() (or if
config.api_token.is_some()), ensure config.bearer_token = None so
serde_json::to_vec(&config) will not emit bearer_token; reference the local
variable config and the fields api_token and bearer_token in your change.
Summary
This PR upgrades the Python client from hypersync-client-rust v0.17 to v1.0.1, bringing new blockchain data fields, bug fixes, and internal improvements. The upgrade includes support for EIP-4844 blob transactions, Optimism L2 fields, new trace fields, and fixes for Block field mappings.
Key Changes
API Changes
ClientConfig.bearer_tokentoapi_tokenwith backward compatibility support (old name still accepted but deprecated)StreamConfig.reversefield to support streaming data in reverse chronological orderNew Transaction Fields
blob_gas_price,blob_gas_useddeposit_nonce,deposit_receipt_version,l1_base_fee_scalar,l1_blob_base_fee,l1_blob_base_fee_scalar,l1_block_number,mint,source_hashsighashNew Trace Fields
sighash- 4-byte function signature hashaction_address- action address for contract creation tracesbalance- balance for the trace operationrefund_address- refund address for refund operationsNew DataType Enum Values
DECIMAL256- 256-bit decimal typeDECIMAL128- 128-bit decimal typeBug Fixes
send_count,send_root, andmix_hashnow correctly map to their respective fields instead of all mapping totransactions_roottype_field from upstream clientInternal Changes
polars-arrowwitharrow-rsv57 for Arrow integrationalloy-json-abi,alloy-dyn-abi,alloy-primitives)Vec<Vec<Event>>to flatVec<Event>structureImplementation Details
api_tokenfield is now primary inClientConfig, withbearer_tokenkept for backward compatibilityarrow::ffi_stream::FFI_ArrowArrayStreamandRecordBatchIteratorinstead of polars-arrow's export mechanismhttps://claude.ai/code/session_01KKQaiY8uNKsLqKz5eAu1fe
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Breaking Changes